package com.project.source;

import java.util.ArrayList;
import java.util.Random;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class SansTopuActivity extends Activity {
	Utility u;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		TextView tv = (TextView) findViewById(R.id.numbers);
		ArrayList<Integer> numbers = GenerateNumbers(5, 1, 34);
		String numberText = "";
		for (int j = 0; j < numbers.size(); j++) {
			if (numberText.equals("")) {
				numberText = String.valueOf(numbers.get(j));
			} else {
				numberText = numberText + "," + String.valueOf(numbers.get(j));
			}
		}
		ArrayList<Integer> plus = u.GenerateNumbers(1, 1, 14);
		
		tv.setText(numbers.toString()+plus.toString());
	}
	 protected  ArrayList<Integer> GenerateNumbers (int count, int start, int end)
	    {
	    	Random randomGenerator = new Random();
	    	ArrayList<Integer> numbers=new ArrayList<Integer>();
	    	ArrayList<Integer> luckynumbers=new ArrayList<Integer>();
	    	for (int i = start; i <= end; ++i){
	    		numbers.add(i);
	    	}
	    	
	    	int control=0;
	    	while (control!=count) 
	    	{
	    		int randomNumber =  randomGenerator.nextInt(end-start)+start;
	    	    if (numbers.contains(randomNumber))
	    	    {
	    	    	numbers.remove((Integer)randomNumber);
	    	    	luckynumbers.add(randomNumber);
	    	    	control++;
	    	    }
	    		
	    	}
	    	
	    	
	    	return luckynumbers;
	    }
}
